home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / x25 / nrs.shar.Z / nrs.shar / Configure < prev    next >
Encoding:
Text File  |  1990-04-27  |  22.8 KB  |  977 lines

  1. #! /bin/sh
  2. # $Header: Configure,v 3.6 88/09/08 17:40:43 pb Exp $
  3. #
  4. # If these # comments don't work, trim them.  Don't worry about the other
  5. # shell scripts, Configure will trim # comments from them for you.
  6. #
  7. # $Log:    Configure,v $
  8. # Revision 3.6  88/09/08  17:40:43  pb
  9. # As installed on global
  10. # Revision 3.6  88/09/08  17:40:43  pb
  11. # Distribution of VME: VME + new level for errors + speed up + misc tidies
  12. # Revision 3.5  88/05/27  06:30:06  pb
  13. # Distribution of EdText: Edtext + check .cf args + triple to file num + make to temp files
  14. # Revision 3.4  87/07/11  11:42:24  pb
  15. # Add quiet switch
  16. # Revision 3.3  87/05/16  06:20:23  pb
  17. # Fix typo
  18. # Revision 3.2  87/03/26  11:46:10  pb
  19. # Distribution of SendmailUK14Upgrade: Upgrade for .dom and .chn files
  20. # Revision 3.1  86/12/23  13:25:15  pb
  21. # Distribution of VmsAppRelayFix: Omit entries for VMS if application relay + DBM+PRIME formats
  22. # Revision 3.0  86/09/26  10:29:01  pb
  23. # Distribution of DERFIL2p0: Pre-release for DERFIL2
  24.  
  25. # Yes, you may rip this off to use in other distribution packages.
  26.  
  27. # list of possible configurations
  28. configlist="fyork fx25hosts fmmdf ftext fsmail fvms4 fvms5 fsendmail fyork21 fdbm1 fprime fedtext fvme fpp"
  29.  
  30. CONFIG=''
  31. c=''
  32. cpp=''
  33. eunice=''
  34. eunicefix=': # '
  35. iandd=''
  36. libc=''
  37. libexp=''
  38. manext=''
  39. mansrc=''
  40. mmdfboth=''
  41. n=''
  42. novfork=''
  43. novoid=''
  44. publicbin=''
  45. sharpbang=''
  46. shsharp=''
  47. startsh=''
  48. strchr=''
  49. datadir=''
  50. memset=''
  51. wdbm=''
  52. awkf=''
  53. dirsample=''
  54. vms21=''
  55. prime=''
  56. edtext=''
  57. smailname=''
  58.  
  59. : sanity checks
  60. PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
  61. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  62.  
  63. if test ! -t 0; then
  64.     echo "Say 'sh Configure', not 'sh <Configure'"
  65.     exit 1
  66. fi
  67.  
  68. tmode=''
  69. all=''
  70. quiet=''
  71. quick=''
  72. blank=' '
  73.  
  74. while test $# -gt 0
  75. do case "$1" in
  76.     quiet)    tmode="$tmode quiet";;
  77.     quick)    tmode="$tmode quick";;
  78.     all)    tmode="$tmode all"  ;;
  79.     normal)    tmode="$tmode "     ;;
  80.     *)    echo unknown mode "'"$1"'"
  81.         exit 1;;
  82.    esac
  83.    shift
  84. done
  85.  
  86. allsys=""
  87. for prog in $configlist ; do eval $prog="" ; done
  88.  
  89. : get old answers, if there is a config file out there
  90. if test -f config.sh; then
  91.     echo "(Fetching default answers from your old config.sh file...)"
  92.     . config.sh
  93. fi
  94.  
  95. mode="${tmode-$mode}"
  96. case "$mode" in *quiet*) quiet=quiet;; esac
  97. case "$mode" in *quick*) quick=quick;; esac
  98. case "$mode" in *all*)   all=all;; esac
  99.  
  100. # If quiet, set echoq to do nothing.
  101. case "$quiet" in
  102. '')    echoq=echo;;
  103. *)    echoq=true;;
  104. esac
  105.  
  106. : some greps do not return status, grrr.
  107. echo "grimblepritz" >grimble
  108. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  109.     contains=contains
  110. else
  111.     if grep grimblepritz grimble >/dev/null 2>&1 ; then
  112.     contains=grep
  113.     else
  114.     contains=contains
  115.     fi
  116. fi
  117. rm grimble
  118. : the following should work in any shell
  119. case $contains in
  120. contains*)
  121.     case "$quiet" in
  122.     ?*)    $echoq " "
  123.     $echoq "AGH!  Grep doesn't return a status.  Attempting remedial action.";;
  124.     esac
  125.     cat >contains <<'EOSS'
  126. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  127. EOSS
  128. chmod 755 contains
  129. esac
  130.  
  131. : first determine how to suppress newline on echo command
  132. $echoq "Checking echo to see how to suppress newlines..."
  133. (echo "hi there\c" ; echo " ") >.echotmp
  134. if $contains c .echotmp >/dev/null 2>&1 ; then
  135.     $echoq "...using -n."
  136.     n='-n'
  137.     c=''
  138. else
  139.     $echoq "...using \\\c."
  140.     n=''
  141.     c='\c'
  142. fi
  143. case "$quick+$quiet" in
  144. +)
  145. echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
  146.     read ans;;
  147. ?*+*)
  148.     $echoq $n "This should all -->$c"
  149.     $echoq "<-- be one line"
  150.     blank="$n $c";;
  151. esac
  152. rm .echotmp
  153.  
  154. : now set up to do reads with possible shell escape
  155. : if this does not work on your machine, 1,$s/. myread/read ans/
  156. cat <<EOSC >myread
  157. ans='!'
  158. while expr "X\$ans" : "X!" >/dev/null; do
  159.     read ans
  160.     case "\$ans" in
  161.     !)
  162.     sh
  163.     echo " "
  164.     echo $n "Your answer: $c"
  165.     ;;
  166.     !*)
  167.     set \`expr "X\$ans" : "X!\(.*\)\$"\`
  168.     sh -c "\$*"
  169.     echo " "
  170.     echo $n "Your answer: $c"
  171.     ;;
  172.     esac
  173. done
  174. EOSC
  175.  
  176. : general instructions
  177. case "$quick" in
  178. '')
  179. sysn=nrs
  180. cat <<EOH
  181.  
  182.            FOR A FAST CONFIGURATION, USE "Configure quick" (and/or quiet)
  183.  
  184.  This installation shell script will examine your system and ask you questions
  185. to determine how $sysn and its auxiliary files should be installed.  If you
  186. get stuck on a question, you may use a ! shell escape to start a subshell or
  187. execute a command.  Many of the questions will have default answers in square
  188. brackets--typing carriage return will give you the default.
  189.  On some of the questions which ask for file or directory names you are
  190. allowed to use the ~name construct to specify the login directory belonging to
  191. "name", even if you don't have a shell which knows about that.
  192. Questions where this is allowed will be marked "(~name ok)"
  193.  Much effort has been expended to ensure that this shell script will run on
  194. any Unix system.  If despite that it blows up on you, your best bet is to edit
  195. Configure and run it again. Also let me (pb@uk.ac.cam.cl) know how I blew it.
  196.  
  197. This installation script affects things by doing direct variable substitutions
  198. on some of the files included in this kit. You can give configure arguments:
  199. quick (to zip through quickly, not asking you to confirm each answer)
  200. quiet (to omit comments on what it is doing and confirmation of its guesses)
  201. all   (to force it to ask you all questions)
  202. normal(to cancel the all the above saved options)
  203.  
  204. EOH
  205.     echo $n "[Type carriage return to continue] $c"
  206.     . myread;;
  207. esac
  208.  
  209. : ----------Now for the statndard Configure stuff ----------
  210. $echoq " "
  211. $echoq "    ... Configuring configure to your system ..."
  212.  
  213. : get list of predefined functions in a handy place
  214. $echoq " "
  215. if test -f /lib/libc.a; then
  216.     $echoq "Your C library is in /lib/libc.a.  You're normal."
  217.     libc=/lib/libc.a
  218. else
  219.     if test -f /usr/lib/libc.a; then
  220.     $echoq "Your C library is in /usr/lib/libc.a, of all places."
  221.     libc=/usr/lib/libc.a
  222.     else
  223.     if test -f "$libc"; then
  224.         $echoq "Your C library is in $libc, like you said before."
  225.     else
  226.         cat <<'EOM'
  227.  
  228. I can't seem to find your C library.  I've looked for /lib/libc.a and
  229. /usr/lib/libc.a, but neither of those are there.  What is the full name
  230. EOM
  231.         echo $n "of your C library? $c"
  232.         . myread
  233.         libc="$ans"
  234.     fi
  235.     fi
  236. fi
  237.  
  238. case "$all$cpp" in
  239. ''|all*)
  240.     : see how we invoke the C preprocessor
  241.     $echoq $blank
  242.     $echoq "Checking to see how your C preprocessor is invoked..."
  243.     cat <<'EOT' >testcpp.c
  244. #define ABC abc
  245. #define XYZ xyz
  246. ABC+XYZ
  247. EOT
  248.     $echoq 'Maybe "cc -E" will work...'
  249.     cc -E testcpp.c >testcpp.out 2>&1
  250.     if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  251.         $echoq "Yup, it does."
  252.         cpp='cc -E'
  253.     else
  254.         $echoq 'Nope...maybe "cc -P" will work...'
  255.         cc -P testcpp.c >testcpp.out 2>&1
  256.         if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  257.         $echoq "Yup, that does."
  258.         cpp='cc -P'
  259.         else
  260.         $echoq 'Nixed again...maybe "/lib/cpp" will work...'
  261.         /lib/cpp testcpp.c >testcpp.out 2>&1
  262.         if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  263.             $echoq "Hooray, it works!  I was beginning to wonder."
  264.             cpp='/lib/cpp'
  265.         else
  266.             $echoq 'Hmm...maybe you already told me...'
  267.             case "$cpp" in
  268.             '') ;;
  269.             *) $cpp testcpp.c >testcpp.out 2>&1;;
  270.             esac
  271.             if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  272.             $echoq "Hooray, you did!  I was beginning to wonder."
  273.             else
  274.             echo "Nope. I can't find a C preprocessor.  Name one: $c"
  275.             . myread
  276.             cpp="$ans"
  277.             $cpp testcpp.c >testcpp.out 2>&1
  278.             if $contains 'abc+xyz' testcpp.out >/dev/null 2>&1 ; then
  279.                 $echoq "OK, that will do."
  280.             else
  281.                 echo "Sorry, I can't get that to work.  Go find one."
  282.                 exit 1
  283.             fi
  284.             fi
  285.         fi
  286.         fi
  287.     fi
  288.     rm -f testcpp.c testcpp.out
  289. ;;
  290. *) $echoq "assuming C preprocessor is still $cpp";;
  291. esac
  292.  
  293. case "$shsharp+$spitshell+$sharpbang" in
  294. ?*+?*+?*)
  295.     $echoq "assuming sh still accepts $sharpbang $spitshell $shsharp";;
  296. *)
  297.     : see if sh knows # comments
  298.     $echoq $blank
  299.     $echoq "Checking your sh to see if it knows about # comments..."
  300.     if sh -c '#' >/dev/null 2>&1 ; then
  301.         $echoq "Your sh handles # comments correctly."
  302.         shsharp=true
  303.         spitshell=cat
  304.         $echoq $blank
  305.         $echoq "Okay, let's see if #! works on this system..."
  306.         echo "#!/bin/echo hi" > try
  307.         $eunicefix try
  308.         chmod 755 try
  309.         try > today
  310.         if test -s today; then
  311.         $echoq "It does."
  312.         sharpbang='#!'
  313.         awkf=""
  314.         else
  315.         echo "#! /bin/echo hi" > try
  316.         $eunicefix try
  317.         chmod 755 try
  318.         try > today
  319.         if test -s today; then
  320.             $echoq "It does."
  321.             sharpbang='#! '
  322.         awkf=""
  323.         else
  324.             $echoq "It doesn't."
  325.             sharpbang=': use '
  326.         awkf="awk -f"
  327.         fi
  328.         fi
  329.     else
  330.         $echoq "Your sh doesn't grok # comments--I will strip them later on."
  331.         shsharp=false
  332.         echo "exec grep -v '^#'" >spitshell
  333.         chmod 755 spitshell
  334.         $eunicefix spitshell
  335.         spitshell=`pwd`/spitshell
  336.         $echoq "I presume that if # doesn't work, #! won't work either!"
  337.         sharpbang=': use '
  338.     awkf="awk -f"
  339.     fi
  340. ;;
  341. esac
  342. rm -rf try today
  343.  
  344. : figure out how to guarantee sh startup
  345. $echoq $blank
  346. case "$quick" in
  347. '')
  348.     $echoq $n "Check sh startup... $c"
  349.     startsh=$sharpbang'/bin/sh'
  350.     $echoq $n "does '$startsh' works... $c"
  351.     cat >try <<EOSS
  352. $startsh
  353. set abc
  354. test "$?abc" != 1
  355. EOSS
  356.     
  357.     chmod 755 try
  358.     $eunicefix try
  359.     if try; then
  360.         $echoq "Yup, it does."
  361.     else
  362.         $echoq "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  363.     fi
  364.     rm -f try today
  365.     ;;
  366. *)  $echoq "assuming ${sharpbang}/bin/sh works" ;;
  367. esac
  368.  
  369. : set up shell script to do ~ expansion
  370. cat >filexp <<EOSS
  371. $startsh
  372. : expand filename
  373. case \$1 in
  374. ~/*|~)
  375.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  376.     ;;
  377. ~*)
  378.     if test -f /bin/csh; then
  379.     /bin/csh -f -c "glob \$1"
  380.     echo ""
  381.     else
  382.     name=\`$expr x\$1 : '..\([^/]*\)'\`
  383.     dir=\`$sed </etc/passwd -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
  384.     if test ! -d "\$dir"; then
  385.         me=\`basename \$0\`
  386.         echo "\$me: can't locate home directory for: \$name" >&2
  387.         exit 1
  388.     fi
  389.     case \$1 in
  390.     */*)
  391.         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  392.         ;;
  393.     *)
  394.         echo \$dir
  395.         ;;
  396.     esac
  397.     fi
  398.     ;;
  399. *)
  400.     echo \$1
  401.     ;;
  402. esac
  403. EOSS
  404. chmod 755 filexp
  405. $eunicefix filexp
  406.  
  407. cat <<EOSC >loc
  408. $startsh
  409.     thing=\$1
  410.     shift
  411.     dflt=\$1
  412.     shift
  413.     for dir in \$*; do
  414.         case "\$thing" in
  415.         .)
  416.         if test -d \$dir/\$thing; then
  417.             echo \$dir
  418.             exit 0
  419.         fi
  420.         ;;
  421.         *)
  422.         if test -f \$dir/\$thing; then
  423.             echo \$dir/\$thing
  424.             exit 0
  425.         fi
  426.         ;;
  427.         esac
  428.     done
  429.     echo \$dflt
  430.     exit 1
  431. EOSC
  432. chmod 755 loc
  433. $eunicefix loc
  434.  
  435. : determine where manual pages go
  436. case "$mansrc" in
  437. '')
  438.     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/catman/u_man/man1 /usr/man/man1`
  439.     ;;
  440. *)  dflt="$mansrc"
  441.     ;;
  442. esac
  443.  
  444. case "$quiet+$quick+$mansrc+$dflt" in
  445. *+?*+?*+?*|?*+*+*+?*)    mansrc=$dflt;;
  446. *)            mansrc='blurfl/dyick';;
  447. esac
  448.  
  449. while test ! -d "$mansrc" ; do
  450.     case $mansrc in
  451.       blurfl*) ;;
  452.       *) echo "$mansrc does not appear to exist."
  453.      echo "If you REALLY want it, type yes to the next question.";;
  454.     esac
  455.     echo " "
  456.     echo $n "Where do the man1 manual pages (source) go? [$dflt] $c"
  457.     . myread
  458.     case "$ans" in
  459.     yes|y)    mansrc=`filexp $dflt`;
  460.     break;;
  461.     esac
  462.     mansrc=`filexp "$ans"`
  463.     case $mansrc in
  464.       '') mansrc=$dflt ;;
  465.     esac
  466.     dflt=$mansrc
  467. done
  468.  
  469. case "$mansrc" in
  470. *l)
  471.     manext=l
  472.     ;;
  473. *n)
  474.     manext=n
  475.     ;;
  476. *)
  477.     manext=1
  478.     ;;
  479. esac
  480.  
  481. : ----------Now for more nrs specific stuff ----------
  482. $echoq " "
  483. $echoq "          ... Now for nrs specific info ..."
  484.  
  485. : check for pdp11
  486. $echoq " "
  487. case "$all$small_proc" in
  488.    define)    $echoq "assuming it still wants small processes";;
  489.    undef)    $echoq "assuming it still wants proper sized processes";;
  490.    '')
  491.     cat <<'EOT' >pdp11.c
  492. #ifdef pdp11
  493. exit 0
  494. #else
  495. exit 1
  496. #endif
  497. EOT
  498.     $cpp pdp11.c | grep exit >pdp11
  499.     chmod 755 pdp11
  500.     $eunicefix pdp11
  501.     rm pdp11.c
  502.     if pdp11; then
  503.     $echoq "This looks like a pdp11 to me."
  504.         if $contains '\-i' $mansrc/cc.1* $mansrc/ld.1* >/dev/null 2>&1 ; then
  505.         echo $n "Your system appears to have separate I and D space.  Is this true? [y] $c"
  506.         . myread
  507.         case "$ans" in
  508.         n*|f*) iandd=' ' ;;
  509.         *)     iandd='-i' ;;
  510.         esac
  511.     else
  512.         echo "Your system appears to NOT have separate I and D space."
  513.         echo $n "Is this correct? [y] $c"
  514.         . myread
  515.         case "$ans" in
  516.         n*|f*) iandd='-i' ;;
  517.         *)     iandd=' ' ;;
  518.         esac
  519.     fi
  520.     else
  521.     $echoq "assuming -i not needed as this doesn't look like a pdp11 to me"
  522.     fi
  523.     rm -f pdp11
  524.     ;;
  525. esac
  526.  
  527. : index or strcpy
  528. $echoq $blank
  529. case "$all$strchr" in
  530. define)    $echoq "assuming your system still uses strchr() and strrchr()";;
  531. undef)    $echoq "assuming your system still uses index() and rindex()";;
  532. *)  if ar t $libc | $contains index.o >/dev/null 2>&1 ; then
  533.         $echoq "Your system appears to use index() and rindex() rather than strchr()"
  534.         $echoq $n "and strrchr().  Is this correct? [y] $c"
  535.         case "$quiet" in
  536.     quiet)    ans=$dflt;;
  537.     *)    . myread;;
  538.     esac
  539.         case "$ans" in
  540.         n*|f*) strchr='define' ;;
  541.         *)     strchr='undef' ;;
  542.         esac
  543.     else
  544.         $echoq "Your system appears to use strchr() and strrchr() rather than index()"
  545.         $echoq $n "and rindex().  Is this correct? [y] $c"
  546.         case "$quiet" in
  547.     quiet)    ans=$dflt;;
  548.     *)    . myread;;
  549.     esac
  550.         case "$ans" in
  551.         n*|f*) strchr=undef ;;
  552.         *)     strchr=define ;;
  553.         esac
  554.     fi
  555.     ;;
  556. esac
  557.  
  558. : bzero or memset
  559. $echoq $blank
  560. case "$all$memset" in
  561. define)    $echoq "assuming your system still uses memset()";;
  562. undef)    $echoq "assuming your system still uses bzero()";;
  563. *)  if ar t $libc | $contains bzero.o >/dev/null 2>&1 ; then
  564.         $echoq "Your system appears to use bzero() rather than memset()"
  565.         $echoq $n "Is this correct? [y] $c"
  566.         case "$quiet" in
  567.     quiet)    ans=$dflt;;
  568.     *)    . myread;;
  569.     esac
  570.         case "$ans" in
  571.         n*|f*) memset='define' ;;
  572.         *)     memset='undef' ;;
  573.         esac
  574.     else
  575.         $echoq "Your system appears to use memset() rather than bzero()"
  576.         $echoq $n "Is this correct? [y] $c"
  577.         case "$quiet" in
  578.     quiet)    ans=$dflt;;
  579.     *)    . myread;;
  580.     esac
  581.         case "$ans" in
  582.         n*|f*) memset=undef ;;
  583.         *)     memset=define ;;
  584.         esac
  585.     fi
  586.     ;;
  587. esac
  588.  
  589.  
  590. : hostname ?
  591. $echoq $blank
  592. case "$all$gethostname" in
  593. define)    $echoq "assuming your system still uses gethostname()";;
  594. undef)    ;;
  595. *)  if ar t $libc | $contains gethostname.o >/dev/null 2>&1 ; then
  596.         $echoq "Your system appears to use gethostname()"
  597.     gethostname='define'
  598.     uname='undef'
  599.     else
  600.     gethostname='undef'
  601.     fi
  602.     ;;
  603. esac
  604.  
  605. : uname ?
  606. $echoq $blank
  607. case "$all$uname" in
  608. define)    $echoq "assuming your system still uses uname()";;
  609. undef)    ;;
  610. *)  if ar t $libc | $contains uname.o >/dev/null 2>&1 ; then
  611.         $echoq "Your system appears to use uname()"
  612.     uname='define'
  613.     gethostname='undef'
  614.     else
  615.     uname='undef'
  616.     fi
  617.     ;;
  618. esac
  619.  
  620. : check for void type
  621. $echoq $blank
  622. case "$all$novoid" in
  623. define)    $echoq "assuming int should still be used in place of void" ;;
  624. undef)  $echoq "assuming cc still understands void" ;;
  625. *)
  626.     $echoq "Checking to see if your C compiler groks the void type..."
  627.     cat >try.c <<'EOCP'
  628. void main();
  629. EOCP
  630.     if cc -c try.c >/dev/null 2>&1 ; then
  631.     novoid='undef'
  632.     $echoq "Yup, it does."
  633.     else
  634.     novoid='define'
  635.     $echoq "Nope, it doesn't (boo hiss).  I will substitute int."
  636.     fi
  637.     rm try.*
  638. ;;
  639. esac
  640.  
  641. : determine where public executables go
  642. case "$publicbin" in
  643. '')
  644.     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  645.     ;;
  646. *)  dflt="$publicbin"
  647.     ;;
  648. esac
  649.  
  650. case "$quick+$publicbin+$dflt" in
  651. ?*+?*+?*) publicbin=$dflt $echoq "assuming public binaries still go in $publicbin";;
  652. *) publicbin='blurfl/dyick';;
  653. esac
  654.  
  655. while test ! -d "$publicbin" ; do
  656.     case $publicbin in
  657.       blurfl*) ;;
  658.       *) echo "$publicbin does not appear to exist."
  659.      echo "If you REALLY want it, type yes to the next question.";;
  660.     esac
  661.     echo " "
  662.     echo $n "Where do you want to put the public executables? [$dflt] $c"
  663.     . myread
  664.     case "$ans" in
  665.     yes|y)    publicbin=`filexp $dflt`;
  666.     break;;
  667.     esac
  668.     publicbin=`filexp $ans`
  669.     case $publicbin in
  670.       '') publicbin=$dflt ;;
  671.     esac
  672.     dflt=$publicbin
  673. done
  674.  
  675. : determine where the DERFIL file goes
  676. case "$datadir" in
  677. '')
  678.     dflt=`loc . /info/nets/nrs`
  679.     ;;
  680. *)  dflt="$datadir"
  681.     ;;
  682. esac
  683. case "$quick+$datadir+$dflt" in
  684. ?*+?*+?*) datadir=$dflt $echoq "assuming DERFIL still goes in $datadir";;
  685. *) datadir='blurfl/dyick';;
  686. esac
  687. while test ! -d "$datadir" ; do
  688.     case $datadir in
  689.       blurfl*) ;;
  690.       *) echo "$datadir does not appear to exist."
  691.      echo "If you REALLY want it, type yes to the next question.";;
  692.     esac
  693.     echo " "
  694.     echo $n "In which directory do you want to put the DERFIL ? [$dflt] $c"
  695.     . myread
  696.     case "$ans" in
  697.     yes|y)    datadir=`filexp $dflt`;
  698.     break;;
  699.     esac
  700.     datadir=`filexp $ans`
  701.     case $datadir in
  702.       '') datadir=$dflt ;;
  703.     esac
  704.     dflt=$datadir
  705. done
  706.  
  707. for f in $configlist
  708. do
  709.     val=`eval echo \\$$f`
  710.     nam=`expr $f : 'f\(.*\)'`
  711.     case "$all$val" in
  712.      define)    $echoq "assuming $nam        format is still wanted" ;;
  713.      undef)    $echoq "assuming $nam        format is still not wanted" ;;
  714.     *)    dflt=yes
  715.         echo $n "is the format $nam    wanted [$dflt] $c"
  716.         . myread
  717.         case $ans in
  718.         ''|y*)    eval $f=define ;;
  719.         *)    eval $f=undef ;;
  720.         esac ;;
  721.     esac
  722. done
  723.  
  724. case "$fsmail+$all+$smailname" in
  725. define+?*+*|define++)
  726.     cat <<!
  727. smail generates an alias file by stripping off components common to your site
  728. !
  729.     dflt="$smailname"
  730.     echo $n "NRS name. What is the your site NRS name [$dflt] $c"
  731.     . myread
  732.     case "$ans" in
  733.     '')    ans="$dflt";;
  734.     esac
  735.     smailname=`echo "$ans" | tr a-z A-Z`
  736.     ;;
  737. define*)    $echoq "assuming NRS name for sendmail is still '$smailname'";;
  738. esac
  739.  
  740. case "$all+$fmmdf+$mmdfboth" in
  741. ?*+define*|+define+)
  742.     cat <<!
  743. The mmdf channel tables need only have one format (short or long) of names
  744. as the domain tables should only generate one format.
  745. However it is possible to generate both formats and get a bigger file.    
  746. !
  747.     dflt=no
  748.     echo $n "are both formats wanted [$dflt] $c"
  749.     . myread
  750.     case $ans in
  751.     y*)    mmdfboth=define ;;
  752.     *)    mmdfboth=undef ;;
  753.     esac ;;
  754. +define+define)    $echoq "assuming mmdf channel tables still have long AND short formats" ;;
  755. +define+undef)    $echoq "assuming mmdf channel tables still have only one format" ;;
  756. *+undef+)    mmdfboth=undef ;;
  757. esac
  758.  
  759. : Now ask where wdbm is
  760. $echoq $blank
  761. case "$fyork+$all$wdbm" in
  762.     undef+)
  763.     $echoq assuming wdbm not used if york format not wanted.
  764.     ;;
  765.     *+|*+all*)
  766.     cat <<!
  767. Wdbm is the programme which writes dbm copies of the directory.
  768. (- means that there is none)
  769. !
  770.     dflt="$wdbm"
  771.     case "$dflt" in
  772.     '')    if [ -f /usr/lib/x25/wdbm ]
  773.         then    dflt=/usr/lib/x25/wdbm
  774.         fi;;
  775.     esac
  776.     echo $n "What is the pathname for wdbm [$dflt] $c"
  777.     . myread
  778.     case "$ans" in
  779.     '')    ans="$dflt";;
  780.     esac
  781.     case "$ans" in
  782.     '-'|'')    wdbm=" " ;;
  783.     *)    wdbm="$ans" ;;
  784.     esac
  785.     ;;
  786.     '*+ ')    $echoq "assuming wdbm is still not available";;
  787.     *)    $echoq "assuming wdbm is still '$wdbm'";;
  788. esac
  789.  
  790. : Check for tailor file if none
  791. $echoq $blank
  792. case "$fmmdf+$sendmail" in
  793.     *define*)
  794.     dflt="ed tailor"
  795.     while test ! -r tailor ; do
  796.         cat <<'EOM'
  797. mmdf.cf and sendmail.cf send their output to a number of different files.
  798. The standard ones (uk.ac, uk.co, etc) are in the main .cf files, but most
  799. sites want to add their own.
  800. To do this create a file called tailor in the current directory with lines of
  801. the form:
  802. filedmn    cl.dom        uk.ac.cam.cl.    uk.ac.cambridge.computer-lab.
  803. filedmn    cam.dom        uk.ac.cam.    uk.ac.cambridge.
  804.  
  805. If you do not need any tailoring, create a null file.
  806.  
  807. Unless your answer is the word 'none' I shall run your answer
  808. and then check that tailor exists.
  809. [ you can use the escape mechanism if you want ]
  810. EOM
  811.     echo $n "What command (or 'none') do you want to run ? [$dflt] ? $c"
  812.     . myread
  813.     case "$ans" in
  814.     '')    ans="$dflt" ;;
  815.     esac
  816.     case "$ans" in
  817.     none) ;;
  818.     *)    sh -c "$ans" ;;
  819.     esac
  820.     done
  821. esac
  822.  
  823. : Now ask what to sample in DATADIR
  824. $echoq $blank
  825. case "$all$dirsample" in
  826.     '')
  827.     cat <<!
  828. The makefile knows when to remake the various output formats by comparing
  829. their date with that of the DERFIL from Salford.
  830. This should be DERFIL2 but may still be DERFIL1.
  831. (If you INSIST on using filettes, you can use MODULE2)
  832. !
  833.     if test -r $datadir/DERFIL2
  834.     then dflt=DERFIL2
  835.     elif test -r $datadir/DERFIL1
  836.     then dflt=DERFIL1
  837.     elif test -r $datadir/MODULE2
  838.     then dflt=MODULE2
  839.     else dflt=DERFIL2
  840.     fi
  841.     echo $n "What is the name of the (sample) derived file [$dflt] $c"
  842.     . myread
  843.     case "$ans" in
  844.     '')    dirsample=$dflt ;;
  845.     *)    dirsample=$ans ;;
  846.     esac
  847.     ;;
  848.     *)    $echoq "assuming sample is still $dirsample";;
  849. esac
  850.  
  851. : preserve RCS keywords in files with variable substitution, grrr
  852. Log='$Log'
  853. Header='$Header'
  854. State='$State'
  855.  
  856. : Warnings
  857. case "$v7" in
  858. define)
  859.     cat <<'EOM'
  860.  
  861. NOTE: the V7 compiler may ignore some #undefs.
  862. Some V7 compilers also have difficulties with #defines near buffer
  863. boundaries, so beware.  You may have to play with the .h spacings.
  864. EOM
  865. ;;
  866. esac
  867.  
  868. $echoq " "
  869. $echoq "End of configuration questions."
  870. $echoq " "
  871.  
  872. : now for derived info ......
  873. case "$prime" in
  874. define)    ;;
  875. *)    prime=undef;;
  876. esac
  877. case "$vms21" in
  878. define)    ;;
  879. *)    vms21=undef;;
  880. esac
  881.  
  882. : create config.sh file
  883. $echoq $blank
  884. outputfile=config.sh
  885. outputfile2=config.sh.$$
  886. rm -f $outputfile.$$
  887. $echoq "Creating $outputfile (with variable substitutions)"
  888. $spitshell <<EOT >$outputfile2
  889. $startsh
  890. # $outputfile
  891. # This file was produced by running the Configure script.
  892. #
  893. # First the items in lists ...
  894. EOT
  895. for x in $systems $configlist ; do echo "$x='`eval echo \\$$x`'" >> $outputfile2; done
  896. $spitshell <<EOT >>$outputfile2
  897. #
  898. # now the rest
  899. #
  900.  
  901. Header='$Header'
  902. Log='$Log'
  903. State='$State'
  904. oldc='$c'
  905. cpp='$cpp'
  906. eunice='$eunice'
  907. eunicefix='$eunicefix'
  908. iandd='$iandd'
  909. libc='$libc'
  910. libexp='$libexp'
  911. manext='$manext'
  912. mansrc='$mansrc'
  913. mmdfboth='$mmdfboth'
  914. mode='$mode'
  915. echoq='$echoq'
  916. oldn='$n'
  917. novoid='$novoid'
  918. publicbin='$publicbin'
  919. shsharp='$shsharp'
  920. spitshell='$spitshell'
  921. sharpbang='$sharpbang'
  922. startsh='$startsh'
  923. strchr='$strchr'
  924. datadir='$datadir'
  925. memset='$memset'
  926. wdbm='$wdbm'
  927. awkf='$awkf'
  928. dirsample='$dirsample'
  929. gethostname='$gethostname'
  930. uname='$uname'
  931. vms21='$vms21'
  932. prime='$prime'
  933. smailname='$smailname'
  934.  
  935. #
  936. # derived by Config
  937. #
  938. CONFIG=true
  939. EOT
  940.  
  941. if cmp $outputfile $outputfile2 > /dev/null 2>& 1
  942. then
  943.     rm -f $outputfile2
  944.     $echoq "    " $outputfile not affected
  945. elif mv $outputfile2 $outputfile
  946. then
  947.     echo "    " $outputfile updated
  948. else
  949.     echo "+++    " $outputfile left in $outputfile2
  950. fi
  951.  
  952. CONFIG=true
  953.  
  954. rm -f .distlist kit*isdone loc filexp myread
  955.  
  956. $echoq " "
  957. $echoq "Doing variable substitutions on various files..."
  958. $echoq " "
  959. if [ ! -r UNIX.LST -a ! -r /tmp/UNIX.LST ]; then ls *.SH > /tmp/UNIX.LST; fi
  960. set `cat UNIX.LST /tmp/UNIX.LST 2>/dev/null | grep '\.SH' | awk '{print $1}'`
  961. for file in $*; do
  962.     if test -r ${file}.local ; then
  963.     . ${file}.local
  964.     else
  965.     . $file
  966.     fi
  967. done
  968. rm -f /tmp/UNIX.LST
  969.